﻿using G.Model;
using G.Model.Runtime;
using G.Runtime;

namespace G.Runtime.Actions
{
    class FightAction : GameElementAction
    {
        private readonly GameElement _Defender;

        public FightAction(GameElement element, GameElement destination)
            : base(element, destination.Location)
        {
            _Defender = destination;
        }

        public GameElement DestinationElement
        {
            get { return _Defender; }
        }

        public override void Execute(GameSpace pGame)
        {
            StandardGameController c = pGame.Controller as StandardGameController;
            c.FireFightEvent(Attacker, _Defender);
            
            pGame.Elements.Actions.Clear();
            
            pGame.Players.DeterminePlayers();
            c.DeterminePlayersTurn();
            c.DetermineElementsReadyToMove();
        }

    }
}
